package com.edu.app.mapper.core.popup;

import com.edu.app.bean.core.popup.CustomersPop;
import com.edu.app.util.AppBaseMapper;

import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface CustomersPopMapper extends AppBaseMapper<CustomersPop> {
    @Select("select id, name from s_customer where status in (0,1)")
    @Results({
            @Result(property = "key",  column = "id"),
            @Result(property = "value", column = "name")
    })
    List<CustomersPop> getCustomersPop();

    @Select("select id, name from s_customer where id not in (select distinct t1.id from s_customer t1 inner join s_user_customer t2 on t1.id = t2.customer_id where t1.status != 1) and status != 1")
    @Results({
            @Result(property = "key",  column = "id"),
            @Result(property = "value", column = "name")
    })
    List<CustomersPop> getNotAssignedCustomersPop();
}
